package com.xhwl.centiotdata.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xhwl.centiotdata.dao.ICampusUserStatisticsDao;
import com.xhwl.common.pojo.cent.iot.CampusUserStatistics;
import com.xhwl.centiotdata.service.ICampusUserStatisticsService;
import com.xhwl.common.pojo.ResultJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CampusUserStatisticsServiceImpl extends ServiceImpl<ICampusUserStatisticsDao, CampusUserStatistics> implements ICampusUserStatisticsService {

    @Autowired
    ICampusUserStatisticsDao campusUserStatisticsDao;

    @Override
    public ResultJson<CampusUserStatistics> getStatistics(CampusUserStatistics campusUserStatistics) {
        CampusUserStatistics statistics = campusUserStatisticsDao.getStatistics(campusUserStatistics);
        return ResultJson.success(statistics);
    }

    @Override
    public ResultJson receiveStatisticsData(CampusUserStatistics campusUserStatistics) {
        campusUserStatisticsDao.insert(campusUserStatistics);
        return ResultJson.success(campusUserStatistics.getId());
    }
}
